package com.talos.ums.dal.mysql.usercarrier;

import com.talos.framework.common.pojo.PageResult;
import com.talos.framework.mybatis.core.mapper.BaseMapperX;
import com.talos.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.talos.ums.controller.admin.usercarrier.vo.UmsUserCarrierPageReqVO;
import com.talos.ums.dal.dataobject.usercarrier.UmsUserCarrierDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户承运商关联表 Mapper
 *
 * @author ${table.author}
 */
@Mapper
public interface UmsUserCarrierMapper extends BaseMapperX<UmsUserCarrierDO> {

    default PageResult<UmsUserCarrierDO> selectPage(UmsUserCarrierPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UmsUserCarrierDO>()
                .eqIfPresent(UmsUserCarrierDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UmsUserCarrierDO::getCarrierId, reqVO.getCarrierId())
                .eqIfPresent(UmsUserCarrierDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(UmsUserCarrierDO::getId));
    }

}
